
from Book import DataBook
import time
import datetime



book = DataBook()
data = book.getData(2)
url = "http://220.191.224.124:"+book.getPort()+"/yypt"
book.initBook(url,data)
if book.seconds == -1:
    print("获取时间失败，将按照系统时间执行点击操作......")
    while (1):
        if book.seconds == -1:
            hour = datetime.datetime.now().hour
            minute = datetime.datetime.now().minute
            second = datetime.datetime.now().second
            if hour == 14 and minute == 59 and second == 59:
                time.sleep(0.7)
                book.doBook()
                break
else:
    time.sleep(book.seconds-5)
    print("距离时间还剩下5秒......")
    time.sleep(4.5)
    book.doBook()

